/********************************************************
Project name: OOP - Home Assignment no. 3

Authors: Rami Berkovsky
         Ofir Cohen

File name: Exceptions.cpp

Purpose: This class contains the exceptions implementation

********************************************************/

#ifndef _EXCEPTIONS_H_
#define _EXCEPTIONS_H_

#include <iostream>

using namespace std;

class NoSuchCommand:public exception
{
public:
    virtual const char* what() const throw()
    {
        return "No such command was found.";
    }
};

class NoEndIfClause:public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Missing endif statement.";
    }
};

class NoEndLoopClause:public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Missing endloop statement.";
    }
};

class UnexpectedEndLoop:public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Unexpected endloop statement.";
    }
};

class UnexpectedEndIf:public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Unexpected endif statement.";
    }
};

class UnexpectedElse:public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Unexpected else statement.";
    }
};


class InvalidRegName:public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Invalid register name. syntax: reg# (whereas # represents a num [0-7])";
    }
};

class InvalidParameters:public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Invalid parameters.";
    }
};

class NegValue:public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Only non-negative values are allowed for one reg operand commands.";
    }
};

class MemoryAllocFailed:public exception
{
public:
    virtual const char* what() const throw()
    {
        return "Memory allocation failed.";
    }
};

class FileNotFound:public exception
{
public:
    virtual const char* what() const throw()
    {
        return "File is missing or couldn't be opened.";
    }
};

class InvalidValue:public exception
{
public:
	virtual const char* what() const throw()
	{
		return "Value must be unsigned long.";
	}
};

#endif